<?php

include_once($cfgPaths['lib'].'cms/type/cmsEditType.o.inc.php');

class cmsEditTextType extends cmsEditType {

 function registerFields () {
   $map[] = $this->name.'text';
   $map[] = $this->name.'autobreak';
   $this->map = &$map;
 }

 function render_html () {
  $fu = 'zaehle(this,this.form.'.$this->name.'_anzahl,65535)';
  $html  = '<div class="xicstypeplugin">'."\n";
  $html .= '    <h3>'.$this->descr.':</h3>'.$this->showFields()."\n";
  $html .= '    '."<input type=\"hidden\" name=\"'.$this->name.'autobreak\" value=\"N\"/>\n";
  $html .= '              <textarea tabindex="'.$this->sender->getNextTabindex($this->name.'text').'" name="'.$this->name.'text" id="'.$this->name.'text" cols="70" rows="25" onfocus="'.$fu.'" onclick="'.$fu.'" onchange="'.$fu.'" onKeydown="'.$fu.'"'."\n";
  $html .= '               onKeyup="'.$fu.'">'.htmlspecialchars($this->getValue($this->name.'text')).'</textarea><br>'."\n";
  $html .= '               Zeichen<div id="'.$this->name.'textchars">:<input name="'.$this->name.'_anzahl" value="'.strlen($this->getValue($this->name.'text')).'" size="5"></div> (max 65535)'."\n";
  $html .= '</div><!-- / type text -->'."\n";
  return $html;
 }

 function render_javascript () {
        global $env;
        if ($env->param('editor') == 'false')
            return;

 	return '
		initFunctions.push(function ()
		{
			'./*document.getElementById("'.$this->name.'textbar").innerHTML = "<input type=\"hidden\" name=\"'.$this->name.'autobreak\" value=\"N\"/>";
			document.getElementById("'.$this->name.'textchars").innerHTML = "";*/
			'xinha_editors.push("'.$this->name.'text");
		});
 	';
 }

}


?>
